//
//  APVideoCommentInputView.m
//  AqualPolo
//
//  Created by dong on 2024/5/13.
//

#import "APVideoCommentInputView.h"

@implementation APVideoCommentInputView

- (APPlaceHolderTextView *)textView{
    if (!_textView) {
        _textView = [[APPlaceHolderTextView alloc] init];
        _textView.layer.cornerRadius = 8;
        _textView.layer.masksToBounds = YES;
        _textView.textView.font = [LYFont fontWithSize:10 fontName:LYFontNamepfr];
        _textView.backgroundColor = LYRGBColor(232, 232, 232);
        _textView.textColor = UIColor.blackColor;
        _textView.placeHolderColor = LYRGBAColor(0, 0, 0, 0.3);
        _textView.placeHolder = @"Enter your ideas...";
        _textView.placeHolderFont = [LYFont fontWithSize:10 fontName:LYFontNamepfr];
        _textView.isPlaceHolderCenter = true;
    }
    return _textView;
}

- (UIButton *)sendButton{
    if (!_sendButton) {
        _sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_sendButton setTitle:@"Send" forState:UIControlStateNormal];
        _sendButton.backgroundColor = LYRGBColor(87, 61, 255);
        _sendButton.layer.cornerRadius = 8;
        _sendButton.layer.masksToBounds = true;
        _sendButton.titleLabel.font = [LYFont fontWithSize:15 fontName:LYFontNamepfr];
    }
    return _sendButton;
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.whiteColor;
        UIView *contentView = [[UIView alloc] init];
        contentView.backgroundColor = LYRGBColor(232, 232, 232);
        contentView.layer.cornerRadius = 8;
        contentView.layer.masksToBounds = true;
        [self addSubview:contentView];
        [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20);
            make.right.equalTo(self).offset(-20);
            make.height.mas_equalTo(36);
            make.centerY.equalTo(self);
        }];
        
        [contentView addSubview:self.sendButton];
        [_sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(67);
            make.top.equalTo(contentView).offset(2);
            make.bottom.right.equalTo(contentView).offset(-2);
        }];
        
        [contentView addSubview:self.textView];
        [_textView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.bottom.equalTo(contentView);
            make.right.equalTo(_sendButton.mas_left).offset(-10);
        }];
        
    }
    return self;
}

@end
